-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove gempyor.seeding
Dependence On gempyor.model_info.ModelInfo
#422
base: dev
Are you sure you want to change the base?
Remove gempyor.seeding
Dependence On gempyor.model_info.ModelInfo
#422
Conversation
* Added explicit exports, * Reordered imports, * Added general structure comments, and * Refactored all lines to be less than 92 characters.
Remvoed the `modinf` arg from the `_DataFrame2NumbaDict` internal utility and replaced it with the individual attributes from the `modinf` object that are needed.
Untangled the `Seeding` class from the `ModelInfo` class by adding a method to `ModelInfo` that interfaces with the `Seeding` class.
Updated remaining references in inactive code, notebooks and the `gempyor.dev` module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good, some minor adjustments suggested.
@@ -164,7 +164,7 @@ def get_static_arguments(modinf: model_info.ModelInfo): | |||
) | |||
|
|||
initial_conditions = modinf.initial_conditions.get_from_config(sim_id=0, modinf=modinf) | |||
seeding_data, seeding_amounts = modinf.seeding.get_from_config(sim_id=0, modinf=modinf) | |||
seeding_data, seeding_amounts = modinf.get_seeding_data(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems preferrable to leave the explicity sim_id=0
style
run_id=run_id, | ||
prefix=prefix, | ||
index=sim_id + self.first_sim_index - 1, | ||
return self.path_prefix / file_paths.create_file_name( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, let's preserve the argument= style here, to save ourselves future heartache
seeding_data, seeding_amounts = modinf.seeding.get_from_file( | ||
sim_id2load, modinf=modinf | ||
) | ||
seeding_data, seeding_amounts = modinf.get_seeding_data(sim_id2load) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not pulling this out of the if-else, like in inference.py?
Describe your changes.
This pull request untangles
gempyor.seeding.Seeding
fromgempyor.model_info.ModelInfo
by requiring explicit values be passed togempyor.seeding.Seeding
. This eases the unit testability of thegempyor.seeding
module. Also adds theModelInfo.get_seeding_data
method which replaces prior calls to theseeding
instance from theModelnfo
instance with amodinf
argument.Does this pull request make any user interface changes? If so please describe.
The user interface changes are:
gempyor.model_info.ModelInfo.get_seeding_data
method,gempyor.seeding.Seeding.get_from_config/file
methods, andgempyor.seeding.Seeding.get_from_file
in favor ofgempyor.seeding.Seeding.get_from_config
.Those are reflected in updates to the documentation in the docstrings of these methods.
What does your pull request address? Tag relevant issues.
This pull request addresses part of GH-397.